/* AgingRule.java
 * 
 * Alfred Olschnoegger
 * 02.06.2008
 */

package domain.objectRules;

import domain.GameObject;
import domain.game.Game;

/**
 * TODO description
 *
 * @date 02.06.2008
 * @author Alfred Olschnoegger
 */

public class AgingRule extends ObjectRule {
	
	

	private int m_MaxAge;
	
	public AgingRule(int maxAge) {
		m_MaxAge = maxAge;		
	}
	
	public void use(GameObject obj, Game game) {
		int age = obj.getAge();
		
		if(age < m_MaxAge) {
			obj.setAge(age + 1);
		} else {
			obj.setActive(false);
		}
	}
}


// end of AgingRule.java
